# Contents: Song.makehash(path)
# Purpose: Takes one audio file and returns a hash of whole audio file (temporary replacement for format-based hashing)
# Status: Temporary replacement for format-based hashing

# required stuff
$:.push("libs") # most of them are in here
require 'digest/md5'


class Song

def Song.make_hash(path)
	# find filesize and set default audio boundaries
	fsize = File.stat(path).size
	astart = 0
	aend = fsize

	# calculate the hash
	wholehash = nil # declare it here so it works
	File.open(path, 'r') do |fh|
		fh.read(astart)
		wholehash = Digest::MD5.hexdigest(fh.read(aend-astart))
	end

	wholehash # return this
end


end # end 'class'
